import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path';
import typedRouter from "vite-plugin-vue-typed-router";
// console.log(path.resolve(process.cwd(), 'src/assets/icons'));
// https://vite.dev/config/
export default defineConfig({
  // base: "./",
  plugins: [
    vue(),
    createSvgIconsPlugin({
      // 指定需要缓存的图标文件夹
      iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
      // 指定symbolId格式
      symbolId: 'icon-[name]',
    }),
    typedRouter({
      dir: "src/router", // 类型文件输出目录（可选）
    }),
  ],
  server: {
    port: 9001,
    host: true,
    //预热频繁文件启动
    warmup: {
      clientFiles: [],
    },
  },
  resolve: {
    // 设置文件./src路径为 @
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
});
